{% extends 'base.html' %}
{% block title %}{{ course.title }} - 课程详情 - 翻转课堂{% endblock %}

{% block container %}
    <div class="ui text container">
        <div class="ui huge header">{{ course.title }}</div>
        <div class="ui container">讲师: {{ course.author.username }}</div>
        <div class="ui tiny header">{% if not course.content %}暂无{% endif %}课程介绍</div>
        <div class="ui divider"></div>
        <p>{{ course.content }}</p>
        {% if request.user.is_authenticated %}
            {% if in_group %}
                你已加入<a href="{% url 'group_detail' in_group.id %}"><div class="ui green button">{{ in_group.name }}</div></a>
            {% else %}
                <div class="ui buttons">
{#                    <a href="{% url 'create_group' course.id %}"><button class="ui positive button">创建团队</button></a>#}
{#                    <div class="or" data-text="或"></div>#}
{#                    <a href="{% url 'groups' %}?course={{ course.id }}"><button class="ui primary button">加入团队</button></a>#}
                </div>
            {% endif %}
        {% else %}
            <div class="ui warning message">登陆后即可组队、参与课程
                <a href="{% url 'login' %}"><div class="ui blue button">前往登录</div></a>
            </div>
        {% endif %}
        <div class="ui divider"></div>
        <div class="ui tiny header">{% if not course.courseupdate_set %}暂无{% endif %}教师提供的课程文章</div>
        <div class="ui divider"></div>
        {% for article in course.courseupdate_set %}
            <div class="ui piled segment">
                <div class="ui header">{{ article.title }}</div>
                <p>{{ article.content }}</p>
            </div>
        {% endfor %}
        <div class="ui tiny header">{% if not groups %}暂无{% endif %}课程团队</div>
        <div class="ui divider"></div>
{#        {% for group in groups %}{% include 'pices/group_without_course.html' %}{% endfor %}#}
    </div>
{% endblock %}
